package com.swiftride.controller.app;

import com.swiftride.pojo.domain.DriverAuthMaterial;
import com.swiftride.result.R;
import com.swiftride.service.IDriverAuthMaterialService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.constraints.NotEmpty;

@Tag(name = "小程序司机实名认证", description = "小程序司机实名认证接口")
@RestController
@RequestMapping("/app/auth")
public class AppDriverAuthMaterialController {

    @Autowired
    private IDriverAuthMaterialService driverAuthMaterialService;

    @Operation(summary = "司机实名认证", description = "司机实名认证接口")
    @Parameter(name = "driverAuthMaterial", description = "司机实名认证数据", required = true)
    @PostMapping
    public R<Void> authMaterial(@RequestBody @NotEmpty DriverAuthMaterial driverAuthMaterial) {
        driverAuthMaterialService.authMaterial(driverAuthMaterial);
        return R.success();
    }

    @Operation(summary = "司机实名认证信息获取", description = "司机实名认证信息获取接口")
    @GetMapping("/authInfo")
    public R<DriverAuthMaterial> getDriverAuthInfo() {
        return R.success(driverAuthMaterialService.getDriverAuthInfo());
    }
}
